<?php
session_start();

/**
 * Script used to retrieve information about the logged in user
 */

// Return json encoded data
header ('Content-type: application/json');

require_once '../core/db.php';
$sql = "SELECT * FROM siteUsers WHERE userID=:usrID";
$query = $db -> prepare($sql);
$query -> bindParam(':usrID', $_SESSION["user"]);
$query -> execute();
$res = $query -> fetch();
if(isset($res['userName'])){
	die(json_encode(array(
			"response" =>  "true",
			"userName" => $res['userName'],
			"password" => $res['password'],
			"userRealName" => $res['userRealName'],
			"email" => $res['email'],
			"town" => $res['homeTown'])
 	));
} else {
	die(json_encode(array("respons" => "Could not find user!")));
}
?>